﻿using System;

namespace VirtualFunction
{
    class Program
    {
        static void Main(string[] args)
        {
            House mansion = new House { Name = "McMansion", Mortgage = 250000 };
            Asset a = mansion;
            Console.WriteLine(mansion.Liability); // 250000
            Console.WriteLine(a.Liability); // 250000

            House cloneHouse = mansion.Clone();
            Console.WriteLine(cloneHouse.Name);

        }
    }
    public class Asset
    {
        public string Name;
        //表达式体属性
        public virtual decimal Liability => 0;

        public virtual Asset Clone() => new Asset { Name = Name };
    }

    public class House : Asset
    {

        public decimal Mortgage;
        public override decimal Liability => Mortgage;

        public override House Clone() => new House { Name = Name, Mortgage = Mortgage };
        public House()
        {
            Console.WriteLine(base.Liability);
        }
    }

    public class Stock : Asset
    {
        public long SharesOwned;


    }

   

}
